package de.baumann.browser.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import de.baumann.browser.R
import de.baumann.browser.api.net.vo.OcTransfer

class OcTransferAdapters() : BaseQuickAdapter<OcTransfer, BaseViewHolder>(R.layout.item_tranfer) {

    override fun convert(helper: BaseViewHolder, item: OcTransfer) {
        helper.setText(R.id.tvTransferAddress, item.toAddress)
        helper.setText(R.id.tvTransferTime, item.createTime)

        when (item.flag) {
            "out" -> {
                helper.setText(R.id.tvTransferAmount, item.amount)
                helper.setImageResource(R.id.ivTransferIcon, R.drawable.zc)
                helper.setTextColor(R.id.tvTransferAmount,mContext.resources.getColor(R.color.green_06CC4C))

            }
            "in" -> {
                helper.setText(R.id.tvTransferAmount, item.amount)
                helper.setImageResource(R.id.ivTransferIcon, R.drawable.zr)
                helper.setTextColor(R.id.tvTransferAmount, mContext.resources.getColor(R.color.blue_3A81F6))
            }
            "fail" -> {

                helper.setText(R.id.tvTransferAmount, "操作失败")
                helper.setImageResource(R.id.ivTransferIcon, R.drawable.shibai)
                helper.setTextColor(R.id.tvTransferAmount, mContext.resources.getColor(R.color.red_E02121))
            }

            "air" -> {

                helper.setText(R.id.tvTransferAmount, item.amount)
                helper.setImageResource(R.id.ivTransferIcon, R.drawable.wakuang_icon)
                helper.setTextColor(R.id.tvTransferAmount, mContext.resources.getColor(R.color.color_FFBE0D))
            }
        }
    }
}